package com.estar.integaration.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.estar.integaration.Mapper.TechPushHistoryMapper;
import com.estar.integaration.Service.ITechPushHistoryService;
import com.estar.integaration.entity.TechPushHistory;
import io.lettuce.core.RedisClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author YJL
 * @since 2021-11-18
 */
@Service
public class TechPushHistoryServiceImpl extends ServiceImpl<TechPushHistoryMapper, TechPushHistory> implements ITechPushHistoryService {

  @Autowired
  TechPushHistoryMapper techPushHistoryMapper;


  @Override
  public List<String> getAllFileName() {

//    LambdaQueryWrapper<TechPushHistory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
//    lambdaQueryWrapper.select(
//        TechPushHistory.class,
//        e -> "file_name".equals(e.getColumn()));
    List<TechPushHistory> techPushHistoryList = techPushHistoryMapper.selectList(null);

    List<String> nameList = new LinkedList<>();

    techPushHistoryList.forEach(t -> nameList.add(t.getFileName()));

    return nameList;
  }

  @Override
  public List<TechPushHistory> getAllHistory() {
    techPushHistoryMapper.selectList(null);
    return null;
  }

  @Override
  public void insert(TechPushHistory techPushHistory) {
    techPushHistoryMapper.insert(techPushHistory);
  }

  @Override
  public void deleteTechPushHistoryById(String id) {
    techPushHistoryMapper.deleteById(id);

  }

  @Override
  public void updateTechPushHistory(TechPushHistory techPushHistory, QueryWrapper queryWrapper) {

  }

  @Override
  public void updateRedisKey(String key, String value) {
    
  }
}
